package com.huluobo.a2109kotlinshopping.category

import androidx.lifecycle.MutableLiveData
import com.huluobo.a2109kotlinshopping.base.BaseViewModel

/**
 *  Created by LC on 2024/1/16.
 */
class CategoryViewModel : BaseViewModel() {
    private val repo = CategoryRepo()
    val success = MutableLiveData<CategoryBeanResult>()
    val failed = MutableLiveData<String>()

    val getGoodsListSuccess = MutableLiveData<CategoryGoodsListBeanResult>()
    val getGoodsListFailed = MutableLiveData<String>()

    fun getCategory() {
        repo.getCategory(success, failed)
    }

    fun getCategoryGoodsList(
        categoryId: Int,
        currentPage: Int,
        pageSize: Int
    ) {
        repo.getCategoryGoodsList(categoryId, currentPage, pageSize, getGoodsListSuccess, getGoodsListFailed)
    }
}